package edu.kjxy.demo0409;

import java.util.Arrays;

public class Demo04 {

	public static void main(String[] args) {
		String s1 = "   三峡大学kjxy    ";
		System.out.println(s1);
		s1 = s1.trim();		//左右清空白，要修改后的值需重新赋值
		System.out.println(s1);
		
		char ch = s1.charAt(0);	//取某个位置的字符
		System.out.println(ch);
		
		boolean f1 = s1.startsWith("三峡"); //以什么开头
		System.out.println(f1);
		
		boolean f2 = s1.endsWith("kjxy");	//以什么结尾
		System.out.println(f2);
		
		int pos = s1.indexOf("kj");	//查找出现的位置
		System.out.println(s1.substring(pos)); 
		
		char[] arr = s1.toCharArray();	//拆成单个字符数组
		System.out.println(Arrays.toString(arr));
	}

}
